import { ref } from "vue";
export const useCounter = (initial?: number) => {
  const count = ref(initial || 0);
  const updated = (num: number) => {
    count.value = num;
  };
  const increment = () => {
    count.value++;
  };
  const decrement = () => {
    count.value--;
  };

  return {
    count,
    updated,
    increment,
    decrement,
  };
};
